<?php

if (!defined('BASEPATH'))
    exit('No direct script access allowed');

class Mod_staff extends PNC_Model {

    public function __construct() {
        parent::__construct();
    }

    /*
     * Login
     * @param string
     * @param string
     * @access public
     * @return array
     */

    function selectdata($session_id) {
        $select_data = $this
                ->db
                ->select('*')
                ->from('pnc_employee')
//                ->join('pnc_group', 'pnc_group.grp_id = pnc_employee.grp_id')
                ->join('pnc_department', 'pnc_department.dept_id = pnc_employee.dept_id')
//						->join('pnc_postition','pnc_postition.pos_id = pnc_employee.pos_id')
//						->join('pnc_record','pnc_record.val_id = pnc_employee.staff_id')
                ->where('staff_id', $session_id)
                ->get();
        /* foreach($this->db->get()->result() as $row){
          $username= $row->username;
          }
          echo $username; */
        return $select_data;
    }

    function total($session_id) {
        $select_data = $this
                ->db
                ->select('*')
                ->from('pnc_record')
                ->where('staff_id', $session_id)
                ->get();
        /* foreach($this->db->get()->result() as $row){
          $username= $row->username;
          }
          echo $username; */
        return $select_data;
    }

    public function personal_leave($staff_id) {
        $query = $this->db
                ->select('*')
                ->from('pnc_record')
                ->join('pnc_employee', 'pnc_employee.staff_id=pnc_record.staff_id')
                ->join('pnc_cup_des', 'pnc_cup_des.desc_id=pnc_record.catch_desc', 'left')
                ->where('pnc_record.staff_id', $staff_id)
                ->get();
        return $query;
    }

}
